<div id="content" style="background-color:#ffffff">

<div id="content-header">
  <div id="breadcrumb"> <a href="?m=admin&t=main" title="Go to Home" class="tip-bottom"><i class="icon-home"></i> 系统首页</a> <a href="#" class="current">商家管理</a> </div>
</div>
<div class="container-fluid" >
  
  <div class="row-fluid" >
  
 <blockquote class="layui-elem-quote layui-quote-nm">
 <a href="?m=admin&o=ticket&t=bus_manage_add" class="layui-btn">新增商家</a>
</blockquote> 
<fieldset class="layui-elem-field layui-field-title">
  <legend>商家列表</legend>
</fieldset>
	<div class="table_bd">
    <table class="layui-table">
	 
	  <thead>
	    <tr>
	      <th>商家名称</th>
	      <th>税号</th>
	      <th>授权码</th>
		  <th>key</th>
		  <th>创建时间</th>
		  <th width="27%">操作</th>
	    </tr> 
	  </thead>
	  <tbody>
		<{section name=list loop=$applist}>
			<tr>
			  <td><{$applist[list].business_name}></td>
			  <td><{$applist[list].taxpayerId}></td>
			  <td><{$applist[list].taxpayerKey}></td>
			  <td><{$applist[list].business_key}></td>
			  <td><{$applist[list].c_time|date_format:'%Y-%m-%d %H:%M:%S'}></td>
			  <td>
              <a shop_id='<{$applist[list].id}>' href="?m=admin&o=ticket&t=createTicket&id=<{$applist[list].id}>" class=" layui-btn layui-btn-normal layui-btn-small">开票</a>
              <a href="?m=admin&o=ticket&t=bus_manage_log_list&id=<{$applist[list].id}>" class="layui-btn layui-btn-small layui-btn-warm">开票记录</a>
              <a href="?m=admin&o=ticket&t=statistics&id=<{$applist[list].id}>" class="layui-btn layui-btn-small layui-btn-primary">开票统计</a>
              <a href="?m=admin&o=ticket&t=bus_manage_edit&id=<{$applist[list].id}>" class="layui-btn layui-btn-small">编辑</a>
              <a href='javascript:;' d_href="?m=admin&o=ticket&t=bus_manage_del&id=<{$applist[list].id}>" class="del layui-btn layui-btn-danger layui-btn-small">删除</a>
              
              </td>
			</tr>
		<{/section}>
	  </tbody>
	</table>
    </div>
<div align='center'><{$page_menu}></div>
      
  </div>
</div>
<script>
layui.use(['layer'], function(){
 	var layer = layui.layer
 	$(".create-ticket").click(function(){
		var shop_id = $(this).attr('shop_id');
		layer.prompt({title: '请输入开票金额，并确认', formType: 0}, function(data, index){
			 $.ajax({
			   type: "POST",
			   url: "index.php?m=admin&o=ticket&t=ajaxCreateTicket",
			   data: "price="+data+"&shop_id="+shop_id,
			   success: function(msg){
				 if(msg==0){
					layer.close(index);
					layer.alert('创建失败！');	 
				 }else{
					layer.close(index);
					layer.open({
						title:'二维码',
						area: ['350px', '450px'],
						content:"<a target='_blank' href='http://weixin_online/app/index.php?i=3&c=entry&do=open_ticket&m=xf_ticket&number="+$.trim(msg)+"'>开票地址</a><br><img src='http://qr.liantu.com/api.php?text=http://weixin.xiangfubao.com.cn/app/index.php?i=3%26c=entry%26do=open_ticket%26m=xf_ticket%26number="+$.trim(msg)+"'>"	
				
					}) 
				 }
			   }
			});
		});
	
	})
  

	
	$(".del").click(function(){
		var url = $(this).attr('d_href');
		layer.confirm('您确定要删除？', {
		  btn: ['确定','取消'] //按钮
		}, function(){
			 location.href=url;
		}, function(){
			layer.closeAll()
		});	
	
	})
	


});
</script>